﻿/*
 ***************************************************************************
 * Microsoft Visual C# .NET
 * 名称：       App_Input_SaleProcessBeginForm
 * 类型：       控制层
 * 功能说明：   销售过程开始页面
 * 作者：       章 昕
 * 创建日期：   2007/08/30
 * 修改日期     修改者      修改内容
 * 
 * 
 * ---
 ***************************************************************************
*/

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Shpm.App.Input.Dao;
using Shpm.App.Input.Bean;
using Shpm.App.Commons.Db.Beans.Master;
using Shpm.App.Commons.Utils;
using Shpm.System.Web.Control;
using log4net;
using System.Text.RegularExpressions;
using Shpm.System;
using Shpm.App.Commons.Db.Beans.Inp;
using Shpm.System.Validator;
using Shpm.App.Master.Dao;

public partial class App_Input_SaleProcessBeginForm : System.Web.UI.Page
{

    // log
    protected static ILog log = LogManager.GetLogger(typeof(App_Input_SaleProcessBeginForm));

    // page load
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!Page.IsPostBack)
            {
                // 画面初始化
                initPageControls();

                this.ViewState["PROC_ID"] = "";
                this.ViewState["CANCEL_FLG"] = null;
                //this.ViewState["CUR_STEP"] = null;

                if (Context.Items["SALE_PROC_ID"] != null)
                {
                    this.ViewState["PROC_ID"] = Convert.ToString(Context.Items["SALE_PROC_ID"]);
                }

                // load exist data
                SysUserManager manager = new SysUserManager(Context);
                SysUserBean sysUserBean = manager.getSysUserBean();

                if (sysUserBean != null)
                {
                    MstEmployeeBean empBean = sysUserBean.getEmployeeBean();
                    lblEmpId.Text = string.Format("{0} {1}", empBean.EmployeeId, empBean.EmployeeName);
                }

                if (this.ViewState["PROC_ID"].ToString().Length > 0)
                {
                    bindSelectData(this.ViewState["PROC_ID"].ToString());
                }
                txtName.Focus();
            }
        }
        catch (Exception ex)
        {
            log.Fatal(ex.StackTrace);
            log.Fatal(ex.Message);
            throw ex;
        }
    }

    // before render
    void Page_PreRender(object sender, EventArgs e)
    {
        if (this.ViewState["PROC_ID"].ToString().Length > 0)
        {
            // get 履历信息
            SaleProcessDao dao = new SaleProcessDao();
            InpSalesVistingBean beanV = new InpSalesVistingBean();
            beanV.SaleProcId = Convert.ToInt32(this.ViewState["PROC_ID"]);
            IList listV = dao.ListSaleProcVisit(beanV);
            viewSrhRst.DataSource = listV;
            viewSrhRst.DataBind();
        }

        // 销售过程跟踪 link 状态
        //setLinkStatus();
    }

    // 登记按钮
    protected void btnOk_Click(object sender, EventArgs e)
    {
        try
        {
            // check is allow insert or update
            if (!ComValidator1.DoValidator())
            {
                ((Design_MasterPage)this.Master).InfoMessage = ComValidator1.ErrorMessage;
                return;
            }

            // check date 
            ComValidateChecker vd = new ComValidateChecker();
            vd.CheckItems.Add(new CheckDate(txtIntentDate.Text, "yyyy/MM/dd", new ComMessage("E0037", "意向日期")));
            if (!vd.DoValidator())
            {
                ((Design_MasterPage)this.Master).InfoMessage = vd.ErrorMessage;
                return;
            }

            // check room intent allow book
            if (!string.IsNullOrEmpty(txtRoomNo.Text))
            {
                MstApartmentBean dataBeanA = new MstApartmentBean();
                dataBeanA.ApartmentNo = txtRoomNo.Text;
                ApartmentDao daoCheckAp = new ApartmentDao();
                dataBeanA = daoCheckAp.Load(dataBeanA);
                if (dataBeanA == null)
                {
                    string strErr = HttpContext.GetGlobalResourceObject("Message", "E0203") as string;
                    ((Design_MasterPage)this.Master).InfoMessage = strErr.Replace("{0}", "房间");
                    return;
                }

                ApartmentStatusBean dataBeanS = new ApartmentStatusBean();
                RoomBookDao daoCheckSt = new RoomBookDao();
                dataBeanS.ApartmentNo = txtRoomNo.Text;
                dataBeanS = daoCheckSt.CountLoad(dataBeanS);
                if (!(dataBeanS != null
                    && dataBeanS.CapacityCount < dataBeanS.Capacity))
                {
                    ((Design_MasterPage)this.Master).InfoMessage = string.Format(HttpContext.GetGlobalResourceObject("Message", "I0010") as string, txtRoomNo.Text);
                    return;
                }
            }

            SaleProcessDao dao = new SaleProcessDao();
            SaleProcessBean beanSP = new SaleProcessBean();
            SysUserManager manager = new SysUserManager(Context);
            SysUserBean sysUserBean = manager.getSysUserBean();
            MstSysUserBean mstSysUserBean =
                sysUserBean == null ? null : sysUserBean.getMstSysUserBean();
            MstEmployeeBean mstEmpBean =
                sysUserBean == null ? null : sysUserBean.getEmployeeBean();
            string loginId = mstSysUserBean == null ? "" : mstSysUserBean.SysUserId;
            string emplyId = mstSysUserBean == null ? "" : mstSysUserBean.EmployeeId;
            string emplyRole = mstEmpBean == null ? "" : mstEmpBean.Role;

            // check employee exist
            MstEmployeeBean beanEmp = new MstEmployeeBean();
            beanEmp.EmployeeId = emplyId;
            IList listEmp = dao.CheckEmployeeExist(beanEmp);
            if (listEmp == null || listEmp.Count == 0)
            {
                ((Design_MasterPage)this.Master).InfoMessage =
                    HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "E0901").ToString();
                return;
            }

            // validate ok
            // set form element to bean
            beanSP.EmployeeId = emplyId;
            beanSP.CancelFlg = false;
            beanSP.RelationName = txtName.Text;
            beanSP.RelationSex = lstGender.SelectedValue;
            beanSP.RelationTelephone = txtTel.Text;
            beanSP.RelationHandset = txtTel.Text;
            beanSP.RelationFax = txtFax.Text;
            beanSP.RelationAddress = txtAddress.Text;
            beanSP.RelationEmail = txtMail.Text;
            beanSP.RelationIntent = lstIntent.SelectedValue;
            beanSP.RelationType = lstCardType.SelectedValue;
            beanSP.RelationSource = lstCusFrom.SelectedValue;
            if (txtAge.Text != string.Empty) beanSP.RelationAge = Convert.ToInt32(txtAge.Text);
            beanSP.RelationMemo = txtMemo.Text;
            beanSP.ApartmentNo = txtRoomNo.Text;
            if (!string.IsNullOrEmpty(txtIntentDate.Text))
                beanSP.IntentDate = DateUtils.convertToDate(txtIntentDate.Text);
            beanSP.UserId = loginId;

            // ADD START BY WWD 
            ViewState["RELATION_INTENT"] = beanSP.RelationIntent;
            // ADD END BY WWD 

            SaleProcessBean beanSPLoad = new SaleProcessBean();
            if (this.ViewState["PROC_ID"].ToString() != string.Empty)
            {
                beanSPLoad.SaleProcId = Convert.ToInt32(this.ViewState["PROC_ID"].ToString());
            }
            beanSPLoad = dao.FindBySaleProcess(beanSPLoad);
            if (this.ViewState["PROC_ID"].ToString().Length == 0 || beanSPLoad == null)
            {
                // 登录 
                log.Info("***** Start INSERT *****");
                beanSP.CurrentStep = 0;
                beanSP.AuditingFlg = false;
                beanSP = dao.InsertProcVist(beanSP);
                if (beanSP != null)
                {
                    this.ViewState["PROC_ID"] = Convert.ToString(beanSP.SaleProcId);
                    bindSelectData(Convert.ToString(beanSP.SaleProcId));
                    //((Design_MasterPage)this.Master).InfoMessage =
                        //HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "I0001").ToString();
                    string directUrl = "~/App/Input/SaleCountForm.aspx";
                    if (!string.IsNullOrEmpty(Convert.ToString(this.ViewState["PROC_ID"])))
                    {
                        Context.Items["SALE_PROC_ID"] = this.ViewState["PROC_ID"];
                    }
                    ControllerUtils.Transfer(this.Context, directUrl, false);
                }
            }
            else
            {
                if (checkAuthority(this.ViewState["PROC_ID"].ToString(), emplyId, emplyRole)
                    || beanSPLoad != null)
                {
                    // 更新
                    beanSPLoad.RelationName = beanSP.RelationName;
                    beanSPLoad.RelationSex = beanSP.RelationSex;
                    beanSPLoad.RelationTelephone = beanSP.RelationTelephone;
                    beanSPLoad.RelationHandset = beanSP.RelationHandset;
                    beanSPLoad.RelationFax = beanSP.RelationFax;
                    beanSPLoad.RelationAddress = beanSP.RelationAddress;
                    beanSPLoad.RelationEmail = beanSP.RelationEmail;
                    beanSPLoad.RelationIntent = beanSP.RelationIntent;
                    beanSPLoad.RelationType = beanSP.RelationType;
                    beanSPLoad.RelationSource = beanSP.RelationSource;
                    beanSPLoad.RelationAge = beanSP.RelationAge;
                    beanSPLoad.RelationMemo = beanSP.RelationMemo;
                    beanSPLoad.ApartmentNo = beanSP.ApartmentNo;
                    beanSPLoad.IntentDate = beanSP.IntentDate;
                    beanSPLoad.UserId = loginId;
                    log.Info("***** Start UPDATE *****");
                    dao.UpdateProcVist(beanSPLoad);
                    bindSelectData(Convert.ToString(beanSPLoad.SaleProcId));
                    ((Design_MasterPage)this.Master).InfoMessage =
                        HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "I0002").ToString();
                }
                else
                {
                    ((Design_MasterPage)this.Master).InfoMessage =
                        HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "E0901").ToString();
                }
            }
        }
        catch (Exception ex)
        {
            log.Fatal(ex.StackTrace);
            log.Fatal(ex.Message);
            throw ex;
        }
    }

    // 清空按钮
    protected void btnClr_Click(object sender, EventArgs e)
    {
        txtName.Text = "";
        if (lstGender.Items.Count > 0) lstGender.SelectedIndex = 0;
        txtTel.Text = "";
        txtFax.Text = "";
        txtAddress.Text = "";
        txtMail.Text = "";
        if (lstCusFrom.Items.Count > 0) lstCusFrom.SelectedIndex = 0;
        if (lstIntent.Items.Count > 0) lstIntent.SelectedIndex = 0;
        if (lstCardType.Items.Count > 0) lstCardType.SelectedIndex = 0;
        txtAge.Text = "";
        txtMemo.Text = "";
        txtRoomNo.Text = "";
        txtIntentDate.Text = "";
    }

    // link 按钮 click
    protected void lnkBtn_Command(object sender, CommandEventArgs e)
    {
        string directUrl = "~/App/Search/SaleProcSrhForm.aspx";
        switch (e.CommandName)
        {
            case "btn0":
                // 销售开始                
                directUrl = "~/App/Input/SaleProcessBeginForm.aspx";
                break;
            case "btn1":
                // 入会登记
                directUrl = "~/App/Input/SaleProcesseMembershipForm.aspx";
                break;
            case "btn2":
                // 体检报告
                directUrl = "~/App/Input/SaleProcessHealthForm.aspx";
                break;
            case "btn3":
                // 资格审核
                directUrl = "~/App/Input/SaleProcessIndefinForm.aspx";
                break;
            case "btn4":
                // 合同签订
                directUrl = "~/App/Input/SaleContractForm.aspx";
                break;
            case "btn5":
                // 费用缴纳
                directUrl = "~/App/Input/PaymentUpdForm.aspx";
                break;
            case "btn6":
                // 礼品发放
                directUrl = "~/App/Search/SaleProcSrhForm.aspx";
                break;
            case "btn7":
                // 完成
                directUrl = "~/App/Search/SaleProcSrhForm.aspx";
                break;
            default:
                break;
        }

        if (!string.IsNullOrEmpty(Convert.ToString(this.ViewState["PROC_ID"])))
        {
            Context.Items["SALE_PROC_ID"] = this.ViewState["PROC_ID"];
        }

        // 校验是否满足意向程度
        SaleProcessBean paramBean = new SaleProcessBean();
        paramBean.SaleProcId = int.Parse(Convert.ToString(this.ViewState["PROC_ID"]));
        paramBean.RelationIntent = "5";

        CheckDataExistsAttribute chkDataExtAttr = new CheckDataExistsAttribute(
            new SaleProcessDao(), SaleProcessDao.EXISTS_INTENT_BY_SALE_PROCESS, paramBean);
        chkDataExtAttr.Code = "App_Input_SaleProcessBegin_Intent_Invalidate";
        ComAbsParamsAttribute param = new ComAbsParamsAttribute();
        chkDataExtAttr.Parameters.Add(param);

        ComValidator2.CheckItems.Add(chkDataExtAttr);

        if (ComValidator2.DoValidator())
        {
            // 成功跳转后续画面
            // Server.Transfer(directUrl, true);
            ControllerUtils.Transfer(Context, directUrl, true);
        }
        else
        {
            // 是否输出错误消息
            ((Design_MasterPage)this.Master).InfoMessage = ComValidator2.ErrorMessage;
        }
    }

    // 是否有更新权限 check
    private Boolean checkAuthority(string procId, string emplyId, string role)
    {
        SaleProcessDao daoCheck = new SaleProcessDao();
        SaleProcessBean bean = new SaleProcessBean();
        bean.SaleProcId = Convert.ToInt32(procId);
        bean.EmployeeId = emplyId;
        bean.Role = role;
        IList list = daoCheck.CheckSaleProcessAu(bean);
        if (list == null || list.Count == 0) return false;
        return true;
    }

    // bind common catalog data 
    private void initPageControls()
    {
        SaleProcessDao dao = new SaleProcessDao();
        CommonDictionaryBean beanComDict = new CommonDictionaryBean();
        IList lstCat = null;

        // 性别
        log.Fatal("\n ***** get SEX catalog *****");
        beanComDict.Catalog = "SEX";
        lstCat = dao.FindByCatalog(beanComDict);
        lstGender.Items.Clear();
        bindDataToListControl("lstGender", lstCat);
        if (lstGender.Items.Count > 0) lstGender.Items[0].Selected = true;

        // 意向程度
        log.Fatal("\n ***** get SALE_PROC_INTENT catalog *****");
        beanComDict.Catalog = "T_SALES_PROC.INTENT";
        lstCat = dao.FindByCatalog(beanComDict);
        lstIntent.Items.Clear();
        bindDataToListControl("lstIntent", lstCat);
        if ("0".Equals(lstIntent.Items[0].Value)) lstIntent.Items.RemoveAt(0);
        if (lstIntent.Items.Count > 0) lstIntent.Items[0].Selected = true;

        // 购买卡类型
        log.Fatal("\n ***** get MEMBER_CARD_TYPE catalog *****");
        beanComDict.Catalog = "MEMBER_TYPE";
        lstCat = dao.FindByCatalog(beanComDict);
        lstCardType.Items.Clear();
        bindDataToListControl("lstCardType", lstCat);
        if ("00".Equals(lstCardType.Items[0].Value)) lstCardType.Items.RemoveAt(0);
        if (lstCardType.Items.Count > 0) lstCardType.Items[0].Selected = true;

        // 客户来源
        beanComDict.Catalog = "T_SALES_PROC.RELATION_SOURCE";
        lstCat = dao.FindByCatalog(beanComDict);
        lstCusFrom.Items.Clear();
        bindDataToListControl("lstCusFrom", lstCat);
        if (lstCusFrom.Items.Count > 0) lstCusFrom.Items[0].Selected = true;

    }


    // bind select data by procId
    private void bindSelectData(string procId)
    {
        SaleProcessDao dao = new SaleProcessDao();
        SaleProcessBean beanSP = new SaleProcessBean();
        beanSP.SaleProcId = Convert.ToInt32(procId);
        beanSP = dao.FindBySaleProcess(beanSP);
        if (beanSP != null)
        {
            lblProcId.Text = beanSP.SaleProcId.ToString();
            lblEmpId.Text = string.Format("{0} {1}", beanSP.EmployeeId, beanSP.EmployeeName);
            this.ViewState["CANCEL_FLG"] = beanSP.CancelFlg;
            //this.ViewState["CUR_STEP"] = beanSP.CurrentStep;
            txtName.Text = beanSP.RelationName;
            lstGender.SelectedValue = beanSP.RelationSex;
            txtTel.Text = beanSP.RelationTelephone;
            txtFax.Text = beanSP.RelationFax;
            txtAddress.Text = beanSP.RelationAddress;
            txtMail.Text = beanSP.RelationEmail;
            lstIntent.SelectedValue = beanSP.RelationIntent;
            lstCardType.SelectedValue = beanSP.RelationType;
            txtAge.Text = Convert.ToString(beanSP.RelationAge);

            // Modify Start By wwd
            // 修改重复登录始终保持前一次的回访信息
            txtMemo.Text = beanSP.RelationMemo;
            // txtMemo.Text = string.Empty;
            // Modify End By wwd

            lstCusFrom.SelectedValue = beanSP.RelationSource;
            txtRoomNo.Text = beanSP.ApartmentNo;
            if (beanSP.IntentDate != null)
                txtIntentDate.Text = DateUtils.convertToString(beanSP.IntentDate.Value);

            // Add Start By wwd
            ViewState["RELATION_INTENT"] = beanSP.RelationIntent;
            // Add End By wwd           

            if (beanSP.CancelFlg || !string.IsNullOrEmpty(beanSP.RelationName))
            {
                btnOk.Enabled = false;
                btnClr.Enabled = false;
                txtName.Enabled = false;
                lstGender.Enabled = false;
                txtTel.Enabled = false;
                txtFax.Enabled = false;
                txtAddress.Enabled = false;
                txtMail.Enabled = false;
                lstIntent.Enabled = false;
                lstCardType.Enabled = false;
                lstCusFrom.Enabled = false;
                txtAge.Enabled = false;
                txtMemo.Enabled = false;
                txtRoomNo.Enabled = false;
                txtIntentDate.Enabled = false;
                txtMemo.Enabled = false;

                if (beanSP.CancelFlg == false && string.IsNullOrEmpty(beanSP.RelationName) == false)
                {
                    btnOk.Enabled = true;
                    btnClr.Enabled = true;
                    //txtMemo.Enabled = true;
                }

                //if (beanSP.CancelFlg)
                //((Design_MasterPage)this.Master).InfoMessage =
                //    HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "I0004").ToString();
            }
        }
    }

    // set link button status
    //private void setLinkStatus()
    //{       
    //    //if (Convert.ToInt32(this.ViewState["CUR_STEP"]) >= SaleProcessDao.SALE_PROCESS_STEP_3)
    //    //{
    //        //if (string.IsNullOrEmpty(((Design_MasterPage)this.Master).InfoMessage))
    //        //{
    //        //    ((Design_MasterPage)this.Master).InfoMessage =
    //        //        HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "I0004").ToString();
    //        //}

    //        //btnOk.Enabled = false;
    //        //btnClr.Enabled = false;
    //    //}

    //    // 流程跟踪 link button
    //    if (this.ViewState["CUR_STEP"] != null && "5".Equals(ViewState["RELATION_INTENT"]))
    //    {
    //        for (int i = 0; i <= Convert.ToInt32(this.ViewState["CUR_STEP"]); i ++)
    //        {
    //            if ((i + 1) < 8 )
    //                ((LinkButton)this.Master.FindControl("ContentPlaceHolder1").FindControl("lnkBtn" + (i + 1).ToString())).Enabled = true;
    //        }
    //    }
    //}

    // bind db data to selected controls
    private void bindDataToListControl(string ControlId, IList LstData)
    {
        if (LstData == null || LstData.Count == 0) return;

        foreach (CommonDictionaryBean bean in LstData)
        {
            if (this.Master.FindControl("ContentPlaceHolder1").FindControl(ControlId) is DropDownList)
            {
                ((DropDownList)this.Master.FindControl("ContentPlaceHolder1").FindControl(ControlId)).Items.Add(new ListItem(bean.Content, bean.DictNo.ToString()));
            }
            else if ((this.Master.FindControl("ContentPlaceHolder1").FindControl(ControlId) is CheckBoxList)
                || (this.Master.FindControl("ContentPlaceHolder1").FindControl(ControlId) is RadioButtonList))
            {
                if (!("lstGender".Equals(ControlId) && string.IsNullOrEmpty(bean.Content)))
                {
                    ((ListControl)this.Master.FindControl("ContentPlaceHolder1").FindControl(ControlId)).Items.Add(new ListItem(bean.Content, bean.DictNo.ToString()));
                }
            }
        }
    }

    protected void modify_Click(object sender, EventArgs e)
    {
        //if (Convert.ToInt32(this.ViewState["CUR_STEP"]) < SaleProcessDao.SALE_PROCESS_STEP_3)
        //{
        btnOk.Enabled = true;
        btnClr.Enabled = true;
        txtName.Enabled = true;
        lstGender.Enabled = true;
        txtTel.Enabled = true;
        txtFax.Enabled = true;
        txtAddress.Enabled = true;
        txtMail.Enabled = true;
        lstIntent.Enabled = true;
        lstCardType.Enabled = true;
        lstCusFrom.Enabled = true;
        txtAge.Enabled = true;
        txtMemo.Enabled = true;
        txtRoomNo.Enabled = true;
        txtIntentDate.Enabled = true;
        txtMemo.Enabled = true;
        txtName.Focus();
        //}
        //else 
        //{
        //   ((Design_MasterPage)this.Master).InfoMessage =
        //        HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "I0004").ToString();
        //}

    }


    protected void viewSrhRst_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ((ImageButton)e.Row.FindControl("ImageButton1")).Enabled = btnOk.Enabled;
        }
    }


    protected void viewSrhRst_RowCommand(object sender, GridViewCommandEventArgs e)
    {

        try
        {
            int rowId = 0;

            if (e.CommandArgument != null)
            {
                rowId = Convert.ToInt32(e.CommandArgument);
                SaleProcessDao dao = new SaleProcessDao();
                InpSalesVistingBean beanV = new InpSalesVistingBean();
                beanV.SaleVisitingId = rowId;
                dao.Delete(beanV);
                //((Design_MasterPage)this.Master).InfoMessage =
                //    HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "I0003").ToString();
                //Response.Write("<script language='JavaScript'> window.alert('回访信息履历删除成功！');</script>");
            }
        }
        catch (Exception ex)
        {
            log.Fatal(ex.StackTrace);
            log.Fatal(ex.Message);
            ((Design_MasterPage)this.Master).InfoMessage =
                HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "E0203").ToString().Replace("{0}", "回访信息履历");
        }

    }

    // tab go
    protected void lnkTab_Command(object sender, CommandEventArgs e)
    {

        string directUrl = "~/App/Input/SaleProcessBeginForm.aspx";
        switch (e.CommandName)
        {
            case "btn0":
                // 新建洽谈
                directUrl = "~/App/Input/SaleProcessBeginForm.aspx";
                break;
            case "btn1":
                // 销售管理
                Context.Items["RIGHT"] = "true";
                directUrl = "~/App/Input/SaleCountForm.aspx";
                break;
            case "btn2":
                // 入住管理
                directUrl = "~/App/Input/MemberForm.aspx";
                break;
            case "btn3":
                // 购卡管理
                directUrl = "~/App/Input/RightPersonForm.aspx";
                break;
            case "btn4":
                // 客户移交                
                directUrl = "~/App/Input/ContractHabitationForm.aspx";
                break;
            case "btn2_1":
                // 主会员信息
                directUrl = "~/App/Input/MemberForm.aspx";
                break;
            case "btn2_2":
                // 副会员信息
                directUrl = "~/App/Input/ViceMemberForm.aspx";
                break;
            case "btn2_3":
                // 陪住人信息
                directUrl = "~/App/Input/AccompanyForm.aspx";
                break;
            case "btn2_4":
                // 体检报告
                directUrl = "~/App/Input/SaleProcessHealthForm.aspx";
                break;
            case "btn2_5":
                // 审核
                directUrl = "~/App/Input/SaleProcessIndefinForm.aspx";
                break;
            case "btn2_6":
                // 入住合同
                directUrl = "~/App/Input/ContractChooseApartmentForm.aspx";
                break;
            case "btn2_7":
                // 特点
                directUrl = "~/App/Input/PersonTraitUpdForm.aspx";
                break;
            default:
                break;
        }
        if (string.IsNullOrEmpty(Convert.ToString(this.ViewState["PROC_ID"])))
        {
            txtName.Focus();
            ((Design_MasterPage)this.Master).InfoMessage =
                HttpContext.GetGlobalResourceObject(Constants.GLOBAL_RESOURCE_NAME, "E0903").ToString().Replace("{0}", "客户基本信息");
            return;        
        }
        Context.Items["SALE_PROC_ID"] = this.ViewState["PROC_ID"];
        ControllerUtils.Transfer(this.Context, directUrl, false);
    }
}
